from django.shortcuts import render_to_response
from django.template.context import RequestContext
from django.http import HttpResponseRedirect
from member.models import *
from member.forms import *


def member(request, template_name='member/members.html'):
    members = Member.objects.all()
    return render_to_response(template_name, locals(), context_instance=RequestContext(request))


def members_form(request, template_name = 'membersForm.html'):
    """

    :param request:
    :param template_name:
    :return:
    """
    if request.method == 'POST':
        form = membersForm(request.POST)
        if form.is_valid():
            return HttpResponseRedirect('/thanks/')
    else:
        form = membersForm()
    return render_to_response(request, 'mem_form.html', {'form': form,})
